package com.example.demo.config;

import com.example.demo.interceptor.CarInterceptor;
import com.example.demo.interceptor.TestInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @创建时间 2020/4/17 11:18
 */
@Configuration
public class WebInterceptorConfig implements WebMvcConfigurer {

    /**
     * 添加拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TestInterceptor())
                .addPathPatterns("/**");

        registry.addInterceptor(new CarInterceptor())
                .addPathPatterns("/**");
    }
}
